<template>
    <div id="manage">
        <div class="manage_top">
            <div class="form">
                <div style="margin: 15px 20px 0 20px">
                    <zy-select v-if="formConfig" :fromValue="queryForm" :formConfig="formConfig" @search="search" @resetForm="resetForm" :actions="actions"></zy-select>
                </div>
                <div style="height: 40px; display: flex; margin: 10px 20px 0 20px">
                    <div class="table_title">{{ table_title }}管理</div>
                    <div class="btns">
                        <el-button v-for="item in actions" :key="item.label" :icon="item.icon" @click="item.click()">{{ item.label }}</el-button>
                    </div>
                </div>
            </div>
        </div>
        <div class="manage_bottom">
            <div class="table">
                <div class="table_mask"></div>
                <zy-table :loading="loading" :tableData="tableData" :tableColumn="tableColumn" :pageSize="pagination.pageSize" :total="pagination.total" @changePage="changePage" @changeID="changeID"></zy-table>
            </div>
        </div>
        <List ref="lists" />
    </div>
</template>
<script>
import { mapState } from 'vuex'
import { formConfig, column } from './formConfig.js'
import SearchManage from '@/components/basic/SearchManage.vue'
import List from './List.vue'
export default {
    extends: SearchManage,
    data() {
        return {
            table_title: '自诊断记录',
            url: 'selfreport',
            queryForm: {
                page: 1,
                scope_id: null,
                scope_id_list: [],
            },
            queryFormC: {
                page: 1,
                size: 20,
                scope_id: null,
                start_time: null,
                end_time: null,
                state: null,
                scope_id_list: [],
            },
        }
    },
    components: {
        List,
    },
    computed: {
        ...mapState('backstage', ['backstageData', 'deviceType']),
        tags() {
            if (this.pagination.total !== undefined) {
                return [{ title: '总数', num: this.pagination.total }]
            } else return []
        },
    },
    methods: {
        handleDetails(val) {
            this.$refs.lists.doOpen(val)
        },
    },
    created() {
        this.searchBtn()
        formConfig[0].options = this.backstageData
        this.formConfig = formConfig
        column[column.length - 1].buttons = [
            {
                icon: 'el-icon-s-comment',
                text: '详情',
                click: (val) => this.handleDetails(val),
                // if: () => this.operate,
            },
        ]

        this.tableColumn = column
    },
}
</script>
